<template name="LinkToSendEmail">
  {{#if emailEnabled}}
    <a href="#" id="btn-send-email">
      <i class="fa fa-send" title="{{_ 'app_compose'}}"></i>
      <span class="hidden-xs">{{_ 'app_compose'}}</span>
    </a>
  {{/if}}
</template>

<template name="SendEmailModal">
  <div class="modal fade full-screen" id="SendEmailModal">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">&times;</button>
          <h4 class="modal-title">{{_ 'message_action_new'}}</h4>
        </div>
        {{#autoForm collection=formCollection schema=formSchema id="send-email-form" type="normal"}}
          <div class="modal-body scroll-box">
            {{> afQuickField name="to"}}
            {{> afQuickField name="subject"}}
            {{> afQuickField name="content"}}
            {{#if pendingFiles.count}}
              <ul class="files nav nav-pills nav-stacked" style="margin-bottom: 10px;">
                {{#each pendingFiles}}
                  <li>
                    {{{fileicon type}}} {{name}} <span class="text-muted">({{filesize size}})</span>
                    <div class="actions pull-right">
                      {{> FileEditNameLink}}
                      {{> FileViewLink}}
                      {{> FileRemoveLink}}
                    </div>
                  </li>
                {{/each}}
              </ul>
            {{/if}}
            <div id="message-form-actions" class="text-muted">
              {{> UploadFile}}
            </div>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">{{_ 'app_action_discard'}}</button>
            <button type="submit" class="btn btn-primary">{{_ 'app_action_send'}}</button>
          </div>
        {{/autoForm}}
      </div>
    </div>
  </div>
</template>
